package cn.HK.controller;

import cn.HK.po.Emp;
import cn.HK.service.RegisterService;
import cn.HK.vo.SystemResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.UnsupportedEncodingException;

@RestController
@RequestMapping("/emp")
public class RegisterController {
    @Autowired
    private RegisterService registerService;
    @RequestMapping(value = "/regist",method = RequestMethod.POST)
    public SystemResult DoRegister(Emp emp) throws UnsupportedEncodingException {

        System.out.println(emp.geteGender());
       try {
           registerService.doRegister(emp);
           return SystemResult.ok();
       }catch (Exception e){
           e.printStackTrace();
           return SystemResult.build(201,"员工注册失败",null);
       }
    }

}
